package com.gxwy.shenzhou;

import com.gxwy.shenzhou.SplitString;
import com.gxwy.shenzhou.StringHandler;
import com.gxwy.shenzhou.Supply;


public class ZhangHuXinXiChaXunResponse implements StringHandler{
 private String khmc;
 private String weizhiwei;
 private String Cpmc;
 private String Zhdh;
 private String Ywdh;
 private String Ccy;
 private String Chbz;
 private String Zhye;
 private String Kyye;
 private String Ckqx;
 private String Xcqx;
 private String Khrq;
 private String Khje;
 private String Dqrq;
 private String Jxbz;
 private String jlzt;
 private String weizhiwei1;
 private int reallen=0;



private static final int KHMC_LEN=12;
 private static final int WEIZHIWEI_LEN=51;
 private static final int CPMC_LEN=40;
 private static final int ZHDH_LEN=32;
 private static final int YWDH_LEN=3;
 private static final int CCY_LEN=2;
 private static final int CHBZ_LEN=1;
 private static final int ZHYE_LEN=15;
 private static final int KYYE_LEN=15;
 private static final int CKQX_LEN=3;
 private static final int XCQX_LEN=3;
 private static final int KHRQ_LEN=8;
 private static final int KHJE_LEN=15;
 private static final int DQRQ_LEN=8;
 private static final int JXBZ_LEN=1;
 private static final int JLZT_LEN=1;
 private static final int WEIZHIWEI1_LEN=225;
 private static final int TOTAL_LEN=KHMC_LEN+WEIZHIWEI_LEN+CPMC_LEN+ZHDH_LEN+YWDH_LEN+CCY_LEN+CHBZ_LEN+ZHYE_LEN+
		 KYYE_LEN+ CKQX_LEN+XCQX_LEN+KHRQ_LEN+KHJE_LEN+DQRQ_LEN+JXBZ_LEN+JLZT_LEN+WEIZHIWEI1_LEN;
		 

	


 private static final int KHMC_FLAG=2;
 private static final int WEIZHIWEI_FLAG=2;
 private static final int CPMC_FLAG=2;
 private static final int ZHDH_FLAG=2;
 private static final int YWDH_FLAG=2;
 private static final int CCY_FLAG=2;
 private static final int CHBZ_FLAG=2;
 private static final int ZHYE_FLAG=1;
 private static final int KYYE_FLAG=1;
 private static final int CKQX_FLAG=2;
 private static final int XCQX_FLAG=2;
 private static final int KHRQ_FLAG=2;
 private static final int KHJE_FLAG=1;
 private static final int DQRQ_FLAG=2;
 private static final int JXBZ_FLAG=2;
 private static final int JLZT_FLAG=2;
 private static final int WEIZHIWEI1_FLAG=2;
 private HeaderResponse header=new HeaderResponse();

 public HeaderResponse getHeader() {
	return header;
}
public void setHeader(HeaderResponse header) {
	this.header = header;
}
 public String getKhmc() {
	return khmc;
}
public void setKhmc(String khmc) throws Exception  {
	if(khmc==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(khmc.getBytes("gbk").length<KHMC_LEN){
	

		this.khmc=Supply.supply(khmc,KHMC_FLAG,KHMC_LEN);;
	}else if(khmc.getBytes("gbk").length>KHMC_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.khmc= khmc;			
	}
}
public String getWeizhiwei() {
	return weizhiwei;
}
public void setWeizhiwei(String weizhiwei) throws Exception{
	if(weizhiwei==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(weizhiwei.getBytes("gbk").length<WEIZHIWEI_LEN){

		this.weizhiwei=	Supply.supply(weizhiwei,WEIZHIWEI_FLAG,WEIZHIWEI_LEN);;
	}else if(weizhiwei.getBytes("gbk").length>WEIZHIWEI_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.weizhiwei= weizhiwei;			
	}
}
public String getCpmc() {
	return Cpmc;
}
public void setCpmc(String cpmc) throws Exception{
	if(cpmc==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(cpmc.getBytes("gbk").length<CPMC_LEN){
		this.Cpmc=Supply.supply(cpmc,CPMC_FLAG,CPMC_LEN);
;
	}else if(cpmc.getBytes("gbk").length>CPMC_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Cpmc= cpmc;			
	}
}
public String getZhdh() {
	return Zhdh;
}
public void setZhdh(String zhdh) throws Exception{
	if(zhdh==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(zhdh.getBytes("gbk").length<ZHDH_LEN){
		

		this.Zhdh=Supply.supply(zhdh,ZHDH_FLAG,ZHDH_LEN);;
	}else if(zhdh.getBytes("gbk").length>ZHDH_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Zhdh= zhdh;			
	}
	}
public String getYwdh() {
	return Ywdh;
}
public void setYwdh(String ywdh) throws Exception{
	if(ywdh==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(ywdh.getBytes("gbk").length<YWDH_LEN){

		this.Ywdh=Supply.supply(ywdh,YWDH_FLAG,YWDH_LEN);
;
	}else if(ywdh.getBytes("gbk").length>YWDH_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Ywdh= ywdh;			
	}
}
public String getCcy() {
	return Ccy;
}
public void setCcy(String ccy)  throws Exception {
	if(ccy==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(ccy.getBytes("gbk").length<CCY_LEN){

		this.Ccy=Supply.supply(ccy,CCY_FLAG,CCY_LEN);;
	}else if(ccy.getBytes("gbk").length>CCY_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Ccy= ccy;			
	}
	}
public String getChbz() {
	return Chbz;
}
public void setChbz(String chbz)  throws Exception{
	if(chbz==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(chbz.getBytes("gbk").length<CHBZ_LEN){
		

		this.Chbz=Supply.supply(chbz,CHBZ_FLAG,CHBZ_LEN);;
	}else if(chbz.getBytes("gbk").length>CHBZ_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Chbz= chbz;			
	}
}
public String getZhye() {
	return Zhye;
}
public void setZhye(String zhye)  throws Exception {
	if(zhye==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(zhye.getBytes("gbk").length<ZHYE_LEN){
		this.Zhye=Supply.supply(zhye,ZHYE_FLAG,ZHYE_LEN);;
	}else if(zhye.getBytes("gbk").length>ZHYE_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Zhye= zhye;			
	}
}

public String getKyye() {
	return Kyye;
}
public void setKyye(String kyye)  throws Exception{
	if(kyye==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(kyye.getBytes("gbk").length<KYYE_LEN){
		this.Kyye=Supply.supply(kyye,KYYE_FLAG,KYYE_LEN);;
	}else if(kyye.getBytes("gbk").length>KYYE_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Kyye=kyye;
	}
}
public String getCkqx() {
	return Ckqx;
}
public void setCkqx(String ckqx)  throws Exception{
	if(ckqx==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(ckqx.getBytes("gbk").length<CKQX_LEN){
		
		this.Ckqx=Supply.supply(ckqx,CKQX_FLAG,CKQX_LEN);;
	}else if(ckqx.getBytes("gbk").length>CKQX_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Ckqx=ckqx;
	}
}
public String getXcqx() {
	return Xcqx;
}
public void setXcqx(String xcqx)  throws Exception{
	if(xcqx==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(xcqx.getBytes("gbk").length<XCQX_LEN){
		Supply.supply(xcqx,XCQX_FLAG,XCQX_LEN);

		this.Xcqx=Supply.supply(xcqx,XCQX_FLAG,XCQX_LEN);;
	}else if(xcqx.getBytes("gbk").length>XCQX_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Xcqx=xcqx;
	}
}
public String getKhrq() {
	return Khrq;
}
public void setKhrq(String khrq)  throws Exception{
	if(khrq==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(khrq.getBytes("gbk").length<KHRQ_LEN){
		Supply.supply(khrq,KHRQ_FLAG,KHRQ_LEN);

		this.Khrq=Supply.supply(khrq,KHRQ_FLAG,KHRQ_LEN);;
	}else if(khrq.getBytes("gbk").length>KHRQ_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Khrq=khrq;
	}
}
public String getKhje() {
	return Khje;
}
public void setKhje(String khje) throws Exception{
	if(khje==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(khje.getBytes("gbk").length<KHJE_LEN){
		this.Khje=Supply.supply(khje,KHJE_FLAG,KHJE_LEN);
;
	}else if(khje.getBytes("gbk").length>KHJE_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Khje=khje;
	}
}
public String getDqrq() {
	return Dqrq;
}
public void setDqrq(String dqrq) throws Exception{
	if(dqrq==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(dqrq.getBytes("gbk").length<DQRQ_LEN){
		this.Dqrq=Supply.supply(dqrq,DQRQ_FLAG,DQRQ_LEN);
   	}else if(dqrq.getBytes("gbk").length>DQRQ_LEN){
		 Exception e=new Exception("Too Long");
	
		 throw e;
	}else{
		this.Dqrq=dqrq;
	}
}
public String getJxbz() {
	return Jxbz;
}
public void setJxbz(String jxbz) throws Exception{
	if(jxbz==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(jxbz.getBytes("gbk").length<JXBZ_LEN){
		
		this.Jxbz=Supply.supply(jxbz,JXBZ_FLAG,JXBZ_LEN);;
	}else if(jxbz.getBytes("gbk").length>JXBZ_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.Jxbz=jxbz;
	}
}
public String getJlzt() {
	return jlzt;
}
public void setJlzt(String jlzt) throws Exception{
	if(jlzt==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(jlzt.getBytes("gbk").length<JLZT_LEN){
		

		this.jlzt=Supply.supply(jlzt,JLZT_FLAG,JLZT_LEN);;
	}else if(jlzt.getBytes("gbk").length>JLZT_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.jlzt=jlzt;
	}
}
public String getWeizhiwei1() {
	return weizhiwei1;
}
public void setWeizhiwei1(String weizhiwei1) throws Exception{
	if(weizhiwei1==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(weizhiwei1.getBytes("gbk").length<WEIZHIWEI1_LEN){
		this.weizhiwei1=Supply.supply(weizhiwei1,WEIZHIWEI1_FLAG,WEIZHIWEI1_LEN);
	}else if(weizhiwei1.getBytes("gbk").length>WEIZHIWEI1_LEN){
		 Exception e=new Exception("Too Long");
		 throw e;
	}else{
		this.weizhiwei1= weizhiwei1;			
	}
}
public String build () throws Exception{
	if(this.getHeader()==null){
		throw new Exception("Header is null");
	}
	if(this.getKhmc()==null){
		this.setKhmc("");
	}
	if(this.getWeizhiwei()==null){
		this.setWeizhiwei("");
	}
	if(this.getCpmc()==null){
		this.setCpmc("");
	}
	if(this.getZhdh()==null){
		this.setZhdh("");
	}
	if(this.getYwdh()==null){
		this.setYwdh("");
	}
	if(this.getCcy()==null){
		this.setCcy("");
	}
	if(this.getChbz()==null)
	{
		this.setChbz("");
	}
	if(this.getZhye()==null){
		this.setZhye("");
	}
	if(this.getKyye()==null){
		this.setKyye("");
	}
	if(this.getCkqx()==null){
		this.setCkqx("");
	}
	if(this.getXcqx()==null){
		this.setXcqx("");
	}
	if(this.getKhrq()==null){
		this.setKhrq("");
	}
	if(this.getKhje()==null){
		this.setKhje("");
	}
	if(this.getDqrq()==null){
		this.setDqrq("");
	}
	if(this.getJxbz()==null){
		this.setJxbz("");
	}
	if(this.getJlzt()==null)
	{
		this.setJlzt("");
	}
	if(this.getWeizhiwei1()==null){
		this.setWeizhiwei1("");
	}
	Integer totallen=header.TOTAL_LEN+TOTAL_LEN-header.LEN_LEN;
    this.getHeader().setLen(totallen.toString());
		return
				this.getHeader().build()+
				this.getKhmc()+this.getWeizhiwei()+this.getCpmc()+this.getZhdh()
				+this.getYwdh()+this.getCcy()+this.getChbz()+this.getZhye()+
				this.getKyye()+this.getCkqx()+this.getXcqx()+
				this.getKhrq()+this.getKhje()+
				this.getDqrq()+this.getJxbz()+this.getJlzt()+this.getWeizhiwei1();
	
	}
public void parse(String str) throws Exception{

	if(str==null){
		Exception e=new Exception("String is null");
		throw e;
	}else if(str.getBytes("gbk").length<TOTAL_LEN+header.TOTAL_LEN){
		Exception e=new Exception("Invalid request");
		throw e;
	}else{

		String headerLen=SplitString.splitString(str,reallen, reallen+header.TOTAL_LEN);
		reallen+=header.TOTAL_LEN;
		header.parse(headerLen);	
		this.setKhmc(SplitString.splitString(str,reallen,KHMC_LEN+reallen));
		reallen+=KHMC_LEN;
		this.setWeizhiwei(SplitString.splitString(str,reallen,reallen+WEIZHIWEI_LEN));
		reallen+=WEIZHIWEI_LEN;
		this.setCpmc(SplitString.splitString(str,reallen,reallen+CPMC_LEN));
		reallen+=CPMC_LEN;
		this.setZhdh(SplitString.splitString(str,reallen,reallen+ZHDH_LEN));
		reallen+=ZHDH_LEN;
		this.setYwdh(SplitString.splitString(str,reallen,reallen+YWDH_LEN));
		reallen+=YWDH_LEN;
        this.setCcy(SplitString.splitString(str,reallen,reallen+CCY_LEN));
        reallen+=CCY_LEN;
        this.setChbz(SplitString.splitString(str,reallen,reallen+CHBZ_LEN));
        reallen+=CHBZ_LEN;
        this.setZhye(SplitString.splitString(str,reallen,reallen+ZHYE_LEN));
        reallen+=ZHYE_LEN;
        this.setKyye(SplitString.splitString(str,reallen,reallen+KYYE_LEN));
        reallen+=KYYE_LEN;
        this.setCkqx(SplitString.splitString(str,reallen,reallen+CKQX_LEN));
        reallen+=CKQX_LEN;
        this.setXcqx(SplitString.splitString(str,reallen,reallen+XCQX_LEN));
        reallen+=XCQX_LEN;
        this.setKhrq(SplitString.splitString(str,reallen,reallen+KHRQ_LEN));
        reallen+=KHRQ_LEN;
        this.setKhje(SplitString.splitString(str,reallen,reallen+KHJE_LEN));
        reallen+=KHJE_LEN;
        this.setDqrq(SplitString.splitString(str,reallen,reallen+DQRQ_LEN));
        reallen+=DQRQ_LEN;
        this.setJxbz(SplitString.splitString(str,reallen,reallen+JXBZ_LEN));
        reallen+=JXBZ_LEN;
        this.setJlzt(SplitString.splitString(str,reallen,reallen+JLZT_LEN));
        reallen+=JLZT_LEN;
        this.setWeizhiwei1(SplitString.splitString(str,reallen,reallen+WEIZHIWEI1_LEN));
       

	}
	
}
public static void main(String args[]) throws Exception
{
	ZhangHuXinXiChaXunResponse build=new ZhangHuXinXiChaXunResponse();
    build.setKhmc("1");
    build.setWeizhiwei("2");
    build.setCpmc("3");
    build.setZhdh("4");
    build.setYwdh("5");
    build.setCcy("6");
     build.setChbz("9");
    build.setZhye("10");
    build.setKyye("11");
    build.setCkqx("12");
    build.setXcqx("13");
    build.setKhrq("14");
    build.setKhje("18");
    build.setJxbz("a");
    build.setJlzt("b");
    build.setDqrq("16");
    build.setWeizhiwei1("19");
    build.build();
    build.parse(build.build());
String ac=	build.getHeader().build()+
	build.getKhmc()+build.getWeizhiwei()+build.getCpmc()+build.getZhdh()
	+build.getYwdh()+build.getCcy()+build.getChbz()+build.getZhye()+
	build.getKyye()+build.getCkqx()+build.getXcqx()+
	build.getKhrq()+build.getKhje()+
	build.getDqrq()+build.getJxbz()+build.getJlzt()+build.getWeizhiwei1();

if(build.build().equals(ac)){
	 System.out.println("yes");
}
String a=build.getKhmc();
System.out.println(a);
String one="1";

 if(a.trim().equals(one)){
	System.out.println("Khmcyes");
 }
 if(build.getWeizhiwei().trim().equals("2")){
	 System.out.println("Weizhiweiyes");
 }
 if(build.getCpmc().trim().equals("3")){
	 System.out.println("Cpmcyes");
 }
 if(build.getZhdh().trim().equals("4")){
	 System.out.println("Zhdhyes");
 }
 if(build.getYwdh().trim().equals("5")){
	 System.out.println("Ywdhyes");
 }
 if(build.getCcy().trim().equals("6")){
	 System.out.println("Ccyyes");
 }
 if(build.getChbz().trim().equals("9")){
	 System.out.println("Chbzyes");
 }
 if(build.getZhye().trim().equals("10")){
	 System.out.println("Zhyeyes");
 }
 if(build.getKyye().trim().equals("11")){
	 System.out.println("Kyyeyes");
 }
 if(build.getCkqx().trim().equals("12")){
	 System.out.println("Ckqxyes");
 }
 if(build.getXcqx().equals("13")){
	 System.out.println("Xcqxyes");
 }
 if(build.getKhrq().trim().equals("14")){
	 System.out.println("Khrqyes");
 }
 if(build.getKhje().trim().equals("15")){
	 System.out.println("Khjeyes");
 }

 if(build.getDqrq().trim().equals("16")){
	 System.out.println("Dqrqyes");
	 
 }else{
	 System.out.println(build.getDqrq());
 }
 if(build.getJxbz().trim().equals("a")){
	 System.out.println("Jxbzyes");
 }
 else{
	 System.out.println(build.getJxbz());
 }
 if(build.getWeizhiwei1().trim().equals("19")){
	 System.out.println("Weizhiwei1yes");
 }

    }
 
}
